<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>客户表单</title>
</head>
<body>
<!-- 客户模态框 -->
<div id="guest-modal" class="fixed inset-0 bg-black/50 z-50 hidden items-center justify-center">
    <div class="bg-white rounded-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto transform transition-all duration-300 scale-95 opacity-0" id="guest-modal-content">
        <div class="p-6 border-b">
            <div class="flex items-center justify-between">
                <h3 class="text-xl font-bold text-neutral-dark" id="guest-modal-title">添加客户</h3>
                <button id="close-guest-modal" class="text-gray-400 hover:text-gray-500">
                    <i class="fa-solid fa-times"></i>
                </button>
            </div>
        </div>

        <div class="p-6">
            <form id="guest-form" class="space-y-4">
                <!-- 隐藏字段：客户ID（用于编辑时传递数据） -->
                <input type="hidden" id="guest-id" name="id">

                <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                    <!-- 客户姓名 -->
                    <div class="space-y-2">
                        <label for="name" class="block text-sm font-medium text-gray-700">
                            客户姓名 <span class="text-red-500">*</span>
                        </label>
                        <input
                            type="text"
                            id="name"
                            name="name"
                            required
                            pattern="^[\u4e00-\u9fa5a-zA-Z\s]{2,20}$"
                            class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-primary focus:border-primary"
                            placeholder="请输入客户姓名（2-20字，支持中英文）"
                        >
                    </div>

                    <!-- 联系电话 -->
                    <div class="space-y-2">
                        <label for="phone" class="block text-sm font-medium text-gray-700">
                            联系电话 <span class="text-red-500">*</span>
                        </label>
                        <input
                            type="tel"
                            id="phone"
                            name="phone"
                            required
                            pattern="^1[3-9]\d{9}$"
                            class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-primary focus:border-primary"
                            placeholder="请输入11位手机号（如：13812345678）"
                        >
                    </div>

                    <!-- 身份证号 -->
                    <div class="space-y-2 md:col-span-2">
                        <label for="id-number" class="block text-sm font-medium text-gray-700">
                            身份证号 <span class="text-red-500">*</span>
                        </label>
                        <input
                            type="text"
                            id="id-number"
                            name="id_number"
                            required
                            pattern="^\d{17}[\dXx]$"
                            class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-primary focus:border-primary"
                            placeholder="请输入18位身份证号（支持X）"
                        >
                    </div>

                    <!-- 电子邮箱 -->
                    <div class="space-y-2">
                        <label for="guest-email" class="block text-sm font-medium text-gray-700">
                            电子邮箱
                        </label>
                        <input
                            type="email"
                            id="guest-email"
                            name="email"
                            class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-primary focus:border-primary"
                            placeholder="请输入有效邮箱（如：user@example.com）"
                        >
                    </div>

                    <!-- 联系地址 -->
                    <div class="space-y-2">
                        <label for="address" class="block text-sm font-medium text-gray-700">
                            联系地址
                        </label>
                        <input
                            type="text"
                            id="address"
                            name="address"
                            class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-primary focus:border-primary"
                            placeholder="请输入省/市/区/街道（如：上海市浦东新区XX路）"
                        >
                    </div>

                    <!-- VIP等级 -->
                    <div class="space-y-2">
                        <label for="vip-level" class="block text-sm font-medium text-gray-700">
                            VIP等级 <span class="text-red-500">*</span>
                        </label>
                        <select
                            id="vip-level"
                            name="vip_level"
                            required
                            class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-primary focus:border-primary appearance-none bg-white"
                        >
                            <option value="" disabled selected>请选择VIP等级</option>
                            <option value="0">白银会员</option>
                            <option value="1">黄金会员</option>
                            <option value="2">白金会员</option>
                            <option value="3">钻石会员</option>
                        </select>
                    </div>

                    <!-- 累计消费 -->
                    <div class="space-y-2">
                        <label for="total-spent" class="block text-sm font-medium text-gray-700">
                            累计消费（元）
                        </label>
                        <div class="relative">
                            <span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500">¥</span>
                            <input
                                type="number"
                                id="total-spent"
                                name="total_spent"
                                step="0.01"
                                min="0"
                                class="w-full pl-8 pr-4 py-2 border border-gray-300 rounded-md focus:ring-primary focus:border-primary"
                                placeholder="0.00"
                            >
                        </div>
                    </div>
                </div>
            </form>
        </div>

        <div class="p-6 border-t flex justify-end gap-3">
            <button
                id="cancel-guest-btn"
                class="px-4 py-2 border border-gray-200 rounded-lg text-sm font-medium text-gray-700 hover:bg-gray-50 transition-colors"
            >
                取消
            </button>
            <button
                id="save-guest-btn"
                class="px-4 py-2 bg-primary text-white rounded-lg text-sm font-medium hover:bg-primary/90 transition-colors"
                type="submit"
            >
                保存
            </button>
        </div>
    </div>
</div>
</body>
</html>